package com.nft.utils.common;

import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.SortedMap;

public class StringBufferUtil {

    public static StringBuffer mapToStringBuffer(Map<String, String> parameterMaps,SortedMap<String, Object> parameterSortMaps){
        StringBuffer sb = new StringBuffer();
        Set es = parameterMaps == null?parameterSortMaps.entrySet():parameterMaps.entrySet();
        Iterator it = es.iterator();
        while (it.hasNext()) {
            Map.Entry entry = (Map.Entry) it.next();
            String k = (String) entry.getKey();
            Object v = entry.getValue();
            if (null != v && !"".equals(v) && !"sign".equals(k) && !"key".equals(k)) {
                sb.append(k + "=" + v + "&");
            }
        }
        return sb;
    }
}
